﻿using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Collections;
using System.Collections.Generic;

namespace FzWeb.Models
{
    /// <summary>
    /// 下拉框数据服务类
    /// </summary>
    public class SelectControlService
    {
        public Entities db
        {
            get
            {
                if (HttpContext.Current.Session["db"] == null)
                {
                    HttpContext.Current.Session["db"] = new Entities();
                }
                return HttpContext.Current.Session["db"] as FzWeb.Models.Entities;
            }
        }

        private BaseDataService baseDataService = new BaseDataService();
        public  ArrayList GetYears()
        {
            ArrayList list = new ArrayList();
            for (int i = 2009; i >=1960; i--)
            {
                list.Add(i);
            }
            return list;
        }

        public  ArrayList GetMonth()
        {
            ArrayList list = new ArrayList();
            for (int i = 1; i <= 12; i++)
            {
                list.Add(i);
            }
            return list;
        }
        public ArrayList GetCompanySize()
        {
            ArrayList list = new ArrayList();
            list.Add("1-49人");
            list.Add("50-99人");
            list.Add("100-499人");
            list.Add("500-999人");
            list.Add("1000人以上");
            return list;
        }

        public ArrayList GetLanguage()
        {
            ArrayList list = new ArrayList();
            list.Add("英语");
            list.Add("俄语");
            list.Add("日语");
            list.Add("德语");
            list.Add("法语");
            list.Add("韩语");
            list.Add("西班牙语");
            list.Add("阿拉伯语");
            list.Add("意大利语");
            list.Add("葡萄牙语");
            list.Add("普通话");
            list.Add("粤语");
            list.Add("上海话");
            list.Add("闽南语");
            list.Add("其它语");
            return list;
        }

        public IDictionary<int, string> GetComputerLevel()
        {
            IDictionary<int, string> list = new Dictionary<int, string>();
            list.Clear();
            list.Add(1, "初级");
            list.Add(2, "中级");
            list.Add(3, "高级");
            list.Add(4, "高校非计算机专业二级");
            list.Add(5, "高校非计算机专业三级(偏软)");
            list.Add(6, "高校非计算机专业三级(偏硬)");
            list.Add(7,"初级程序员");
            list.Add(8, "程序员");
            list.Add(9, "高级程序员");
            list.Add(10, "系统分析员");
            list.Add(11, "网络程序员");
            list.Add(12, "网络设计师");
            list.Add(13, "全国计算机等级考试一级");
            list.Add(14, "全国计算机等级考试二级");
            list.Add(15, "全国计算机等级考试三级");
            list.Add(16, "全国计算机等级考试四级");
            list.Add(17, "微软认证产品专家(MCP)");
            list.Add(18, "微软认证网站建造专家(MCP+Site Builder)");
            list.Add(19, "微软认证系统工程师(MCSE)");
            list.Add(20, "微软认证数据库管理员(MCDBA)");
            list.Add(21, "微软认证开发专家(MCSD)");
            list.Add(22, "Cisco职业资格认证CCNA");
            list.Add(23, "Cisco职业资格认证CCDP");
            list.Add(24, "Cisco职业资格认证CCNP");
            list.Add(25, "Cisco职业资格认证CCIE");
            list.Add(26, "Oracle8数据库管理员");
            list.Add(27, "Lotus资格认证");
            list.Add(28, "Lotus-CLS资格认证");
            list.Add(29, "Lotus-CLI资格认证");
            list.Add(30, "Notes应用开发工程师");
            list.Add(31, "Notes系统管理工程师");
            list.Add(32, "Notes高级应用开发工程师");
            list.Add(33, "Notes高级系统管理工程师");
            list.Add(34, "IBM-DB2数据库管理员");
            list.Add(35, "IBM-DB2应用开发专家");
            list.Add(36, "IBM-MQSeries工程师");
            return list;
        }


        public ArrayList GetLanguageLevel()
        {
            ArrayList list = new ArrayList();
            list.Add("精通");
            list.Add("熟练");
            list.Add("良好");
            list.Add("一般");
            return list;
        }

        public IDictionary<int, string> GetSex()
        {
            IDictionary<int, string> list = new Dictionary<int, string>();
            list.Add(0, "不限");
            list.Add(1, "男");
            list.Add(2, "女");
            return list;
        }

        /// <summary>
        /// 面试结果
        /// </summary>
        /// <returns></returns>
        public IDictionary<int, string> GetInterviewResult()
        {
            IDictionary<int, string> list = new Dictionary<int, string>();
            list.Clear();
            list.Add(0, "未面试");
            list.Add(1, "未录取");
            list.Add(2, "已录取");
            return list;
        }

        public IDictionary<int, string> GetNations()
        {
            IDictionary<int, string> list = new Dictionary<int, string>();
            list.Clear();
            list.Add(1,"汉族");
            list.Add(2,"蒙古族");
            list.Add(3,"回族");
            list.Add(4,"藏族");
            list.Add(5,"苗族");
            list.Add(6,"彝族");
            list.Add(7,"壮族");
            list.Add(8,"布依族");
            list.Add(9,"朝鲜族");
            list.Add(10,"满族");
            list.Add(11,"侗族");
            list.Add(12,"瑶族");
            list.Add(13,"白族");
            list.Add(14,"土家族");
            list.Add(15,"哈尼族");
            list.Add(16,"哈萨克族");
            list.Add(17,"傣族");
            list.Add(18,"黎族");
            list.Add(19,"傈僳族");
            list.Add(20,"佤族");
            list.Add(21,"畲族");
            list.Add(22,"高山族");
            list.Add(23,"拉祜族");
            list.Add(24,"水族");
            list.Add(25,"东乡族");
            list.Add(26,"纳西族");
            list.Add(27,"景颇族");
            list.Add(28,"柯尔克孜族");
            list.Add(29,"土族");
            list.Add(30,"达乌尔族");
            list.Add(31,"羌族");
            list.Add(32,"仫佬族");
            list.Add(33,"布朗族");
            list.Add(34,"撒拉族");
            list.Add(35,"毛难族");
            list.Add(36,"仡佬族");
            list.Add(37,"锡伯族");
            list.Add(38,"阿昌族");
            list.Add(39,"普米族");
            list.Add(40,"塔吉克族");
            list.Add(41,"怒族");
            list.Add(42,"乌孜别克族");
            list.Add(43,"俄罗斯族");
            list.Add(44,"鄂温克族");
            list.Add(45,"崩龙族");
            list.Add(46,"保安族");
            list.Add(47,"裕固族");
            list.Add(48,"京族");
            list.Add(49,"维吾尔族");
            list.Add(50,"塔塔尔族");
            list.Add(51,"独龙族");
            list.Add(52,"鄂伦春族");
            list.Add(53,"赫哲族");
            list.Add(54,"门巴族");
            list.Add(55,"珞巴族");
            list.Add(56,"基诺族");
            list.Add(57,"其他");
            return list;
        }


        /// <summary>
        /// 婚姻状况
        /// 0-未婚 1-已婚 2-离异 3-保密
        /// </summary>
        /// <returns></returns>
        public IDictionary<int, string> GetMarriage()
        {
            IDictionary<int, string> list = new Dictionary<int, string>();
            list.Clear();
            list.Add(0,"未婚");
            list.Add(1,"已婚");
            list.Add(2,"离异");
            list.Add(3,"保密");
            return list;
        }

        /// <summary>
        /// 工作状态
        /// 0-待岗 1-在职 
        /// </summary>
        /// <returns></returns>
        public IDictionary<int, string> GetWorkStatus()
        {
            IDictionary<int, string> list = new Dictionary<int, string>();
            list.Clear();
            list.Add(0, "待岗");
            list.Add(1, "在职");
            list.Add(2, "应届生");
            list.Add(3, "在校生");
            list.Add(4, "社会人才");
            return list;
        }

        /// <summary>
        /// 取证件类型 
        /// 0-身份证、1-军人证、2-港澳身份证、3-台胞证、4-护照、5-其他
        /// </summary>
        /// <returns></returns>
        public IDictionary<int, string> GetCredentialtype()
        {
            IDictionary<int, string> list = new Dictionary<int, string>();
            list.Clear();
            list.Add(0, "身份证");
            list.Add(1, "军人证");
            list.Add(2, "港澳身份证");
            list.Add(3, "台胞证");
            list.Add(4, "护照");
            list.Add(5, "其他");
            return list;
        }

        /// <summary>
        /// 取工作年限1-7
        /// </summary>
        /// <returns></returns>
        public IDictionary<int, string> GetWorkLenth()
        {
            IDictionary<int, string> list = new Dictionary<int, string>();
            list.Add(0,"无");
            list.Add(1,"1 年");
            list.Add(2,"2 年");
            list.Add(3,"3 年");
            list.Add(4,"4 年");
            list.Add(5,"5 年");
            list.Add(6,"6 年");
            list.Add(7,"7 年");
            list.Add(8,"8 年");
            list.Add(9,"9 年");
            list.Add(10,"10 年以上");
            return list;
        }

        

        public ArrayList GetSalary()
        {
            ArrayList list = new ArrayList();
            list.Add("500");
            list.Add("1000");
            list.Add("1500");
            list.Add("2000");
            list.Add("2500");
            list.Add("3000");
            list.Add("3500");
            list.Add("5000");
            list.Add("10000");
            list.Add("30000");
            list.Add("50000");
            list.Add("100000");
            list.Add("10万以上");
            list.Add("面谈");
            return list;
        }

        /// <summary>
        /// 到岗时间
        /// </summary>
        /// <returns></returns>
        public ArrayList GetArriveTime()
        {
            ArrayList list = new ArrayList();
            list.Add("随时");
            list.Add("一周内");
            list.Add("一个月内");
            list.Add("1～3个月");
            list.Add("3个月以后");
            list.Add("面谈");
            return list;
        }

        /// <summary>
        /// 兼职工资单位
        /// </summary>
        /// <returns></returns>
        public ArrayList GetPartTimeSalaryUnit()
        {
            ArrayList list = new ArrayList();
            list.Clear();
            list.Add("小时");
            list.Add("天");
            list.Add("月");
            list.Add("面谈");
            return list;
        }

     
        /// <summary>
        /// 取开卡银行
        /// </summary>
        /// <returns></returns>
        public IDictionary<int, string> GetBanks()
        {
            IDictionary<int, string> list = new Dictionary<int, string>();
            list.Clear();
            list.Add(0, "中国银行");
            list.Add(1, "工商银行");
            list.Add(2, "建设银行");
            list.Add(3, "招商银行");
            list.Add(4, "交通银行");
            return list;
        }

        /// <summary>
        /// 取教育程度列表
        /// </summary>
        /// <param name="ParentAreaId"></param>
        /// <returns></returns>
        public IDictionary<int, string> GetEducationList()
        {
            IDictionary<int, string> list = new Dictionary<int, string>();
            BaseDataService bds = new BaseDataService();
            foreach (Education e in bds.GetEducationList())
            {
                list.Add(e.Id, e.Name);
            }
            return list;
        }

        /// <summary>
        /// 取政治面貌列表
        /// </summary>
        /// <returns></returns>
        public IDictionary<int, string> GetPoliticalStatusList()
        {
            IDictionary<int, string> list = new Dictionary<int, string>();
            BaseDataService bds = new BaseDataService();
            foreach (PoliticalStatus p in bds.GetPoliticalStatusList())
            {
                list.Add(p.Id,p.Name);
            }
            return list;
        }

        /// <summary>
        /// 取公司类型
        /// </summary>
        /// <returns></returns>
        public IDictionary<int, string> GetCompanyTypeList()
        {
            IDictionary<int, string> list = new Dictionary<int, string>();
            foreach (CompanyType p in baseDataService.GetCompanyTypeList())
            {
                list.Add(p.Id, p.Name);
            }
            return list;
        }

        
        public IDictionary<int, string> GetPostDate()
        {
            IDictionary<int, string> list = new Dictionary<int, string>();
            list.Add(1, "一天内");
            list.Add(3, "三天内");
            list.Add(7, "一周内");
            list.Add(15, "半个月");
            list.Add(30, "一个月");
            list.Add(90, "三个月");
            list.Add(180, "半年内");
            list.Add(360, "一年内");
            return list;
        }



        internal IDictionary<string, string> getkeywordRange()
        {
            IDictionary<string, string> list = new Dictionary<string, string>();
            list.Add("1","全文");
            list.Add("2","职位名称");
            list.Add("3","公司名称" );
            return list;
        }

        public IDictionary<int, string> getApplyStatus()
        {
            IDictionary<int, string> list = new Dictionary<int, string>();
            list.Add(0,"未申请");
            list.Add(1, "已申请");            
            return list;
        }


        public IDictionary<int, string> GetApplyReadStatus()
        {
            IDictionary<int, string> list = new Dictionary<int, string>();
            list.Add(0, "未阅读");
            list.Add(1, "已阅读");
            return list;
        }


        /// <summary>
        /// 所属行业
        /// </summary>
        /// <returns></returns>
        public IDictionary<int, string> GetCompanyIndustry()
        {
            IDictionary<int, string> list = new Dictionary<int, string>();
            var vocations = db.Vocation.OrderBy(c => c.Order).ToList();
            foreach (var o in vocations)
            {
                list.Add(o.Id, o.Name);
            }
            return list;
        }

        public IDictionary<int, string> GetCompanyRegisteredCapital() 
        {
            IDictionary<int, string> list = new Dictionary<int, string>();
            list.Add(1, "100万以下");
            list.Add(2, "100-500万");
            list.Add(3, "500-1000万");
            list.Add(4, "1000-5000万");
            list.Add(5, "5000万以上");
            return list;
        }

        //面试结果 0-未面试 1-未录用 2-已录用
        //public IDictionary<int, string> GetInterviewResult()
        //{
        //    IDictionary<int, string> list = new Dictionary<int, string>();
        //    list.Add(0, "未面试");
        //    list.Add(1, "未录用");
        //    list.Add(2, "已录用");
        //    return list;
        //}

        //public ArrayList GetInterviewResult()
        //{
        //    ArrayList list = new ArrayList();
        //    list.Add( "未面试");
        //    list.Add( "未录用");
        //    list.Add( "已录用");
        //    return list;
        //}


        public ArrayList GetAge()
        {
            ArrayList list = new ArrayList();
            for (int i = 16; i <= 61; i++)
            {
                list.Add(i);
            }
            return list;
        }

        public IDictionary<int, string> GetNewsClass()
        {
            IDictionary<int, string> list = new Dictionary<int, string>();
            IList<News_Class> newsClassList = baseDataService.GetNewsClassList();
            foreach (var item in newsClassList)
            {
                list.Add(item.Id, item.Name);
                foreach (var i in item.News_Childs)
                {
                    list.Add(i.Id, "   --" + i.Name);
                }
            }

            return list;
        }

        public ArrayList GetAdPostion()
        {
            ArrayList list = new ArrayList();
            list.Add("首页slide(470*200)");
            list.Add("首页ad1(188*60 最多4个");
            list.Add("首页ad2(188*60 最多8个");
            list.Add("部分合作单位(**90");
            list.Add("友情链接(90*30 无图片显示公司名");
            return list;
        }

        public IDictionary<int, string> GetPostList()
        {
            PostService ps = new PostService();
            IDictionary<int, string> list = new Dictionary<int, string>();
            IList<Post> postList = ps.GetPostList();
            foreach (var item in postList)
            {
                list.Add(item.PostId, item.Name);
            }

            return list;
        }

        /// <summary>
        /// 支付结果
        /// </summary>
        /// <returns></returns>
        public IDictionary<int, string> GetPaymentResult()
        {
            IDictionary<int, string> list = new Dictionary<int, string>();
            list.Clear();
            list.Add(0, "未支付");
            list.Add(1, "已支付");
            return list;
        }

    }
}
